package dao

import (
	"flamego-study/model"

	_ "github.com/mattn/go-sqlite3"
	"xorm.io/xorm"
	"xorm.io/xorm/log"
)

var engine *xorm.Engine

func Init() {
	var err error
	engine, err = xorm.NewEngine("sqlite3", "./test.db")
	if err != nil {
		println(err.Error())
	}
	engine.Logger().SetLevel(log.LOG_DEBUG)
	engine.ShowSQL(true)
	err = engine.Sync2(new(model.UserModel))
	if err != nil {
		println(err.Error())
	}

}
